home *** CD-ROM | disk | FTP | other *** search
-
-
-
- SSSSTTTTDDDDIIIIOOOO((((3333SSSS)))) SSSSTTTTDDDDIIIIOOOO((((3333SSSS))))
-
-
-
- NNNNAAAAMMMMEEEE
- stdio - standard buffered input/output package
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<ssssttttddddiiiioooo....hhhh>>>>
-
- FFFFIIIILLLLEEEE ****ssssttttddddiiiinnnn,,,, ****ssssttttddddoooouuuutttt,,,, ****ssssttttddddeeeerrrrrrrr;;;;
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- The functions described in the entries of sub-class 3S of this manual
- constitute an efficient, user-level I/O buffering scheme. The in-line
- macros _g_e_t_c(3S) and _p_u_t_c(3S) handle characters quickly. The macros
- _g_e_t_c_h_a_r and _p_u_t_c_h_a_r, and the higher-level routines _f_g_e_t_c, _f_g_e_t_s, _f_p_r_i_n_t_f,
- _f_p_u_t_c, _f_p_u_t_s, _f_r_e_a_d, _f_s_c_a_n_f, _f_w_r_i_t_e, _g_e_t_s, _g_e_t_w, _p_r_i_n_t_f, _p_u_t_s, _p_u_t_w, and
- _s_c_a_n_f all use or act as if they use _g_e_t_c and _p_u_t_c; they can be freely
- intermixed.
-
- A file with associated buffering is called a _s_t_r_e_a_m and is declared to be
- a pointer to a defined type FFFFIIIILLLLEEEE. _f_o_p_e_n(3S) creates certain descriptive
- data for a stream and returns a pointer to designate the stream in all
- further transactions. Normally, there are three open streams with
- constant pointers declared in the <stdio.h> header file and associated
- with the standard open files:
-
- ssssttttddddiiiinnnn standard input file
- ssssttttddddoooouuuutttt standard output file
- ssssttttddddeeeerrrrrrrr standard error file
-
- The following symbolic values in <_u_n_i_s_t_d._h> define the file descriptors
- that will be associated with the C-language _s_t_d_i_n, _s_t_d_o_u_t and _s_t_d_e_r_r when
- the application is started:
-
- SSSSTTTTDDDDIIIINNNN____FFFFIIIILLLLEEEENNNNOOOO Standard input value, _s_t_d_i_n. It has the value of
- 0.
- SSSSTTTTDDDDOOOOUUUUTTTT____FFFFIIIILLLLEEEENNNNOOOO Standard output value, _s_t_d_o_u_t. It has the value of
- 1.
- SSSSTTTTDDDDEEEERRRRRRRR____FFFFIIIILLLLEEEENNNNOOOO Standard error value, _s_t_d_e_r_r. It has the value of
- 2.
-
- A constant NNNNUUUULLLLLLLL (0) designates a nonexistent pointer.
-
- An integer-constant EEEEOOOOFFFF (-1) is returned upon end-of-file or error by
- most integer functions that deal with streams (see the individual
- descriptions for details).
-
- An integer constant BBBBUUUUFFFFSSSSIIIIZZZZ specifies the size of the buffers used by the
- particular implementation.
-
- An integer constant FFFFIIIILLLLEEEENNNNAAAAMMMMEEEE____MMMMAAAAXXXX specifies the size needed for an array
- of _c_h_a_r large enough to hold the longest file name string that the
- implementation guarantees can be opened.
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- SSSSTTTTDDDDIIIIOOOO((((3333SSSS)))) SSSSTTTTDDDDIIIIOOOO((((3333SSSS))))
-
-
-
- An integer constant FFFFOOOOPPPPEEEENNNN____MMMMAAAAXXXX specifies the minimum number of files that
- the implementation guarantees can be open simultaneously. Note that no
- more than 255 files may be opened via _f_o_p_e_n, and only file descriptors 0
- through 255 are valid.
-
- Any program that uses this package must include the header file of
- pertinent macro definitions, as follows:
-
- #include <stdio.h>
-
- The functions and constants mentioned in the entries of sub-class 3S of
- this manual are declared in that header file and need no further
- declaration. The constants and the following ``functions'' are
- implemented as macros (redeclaration of these names is perilous): _g_e_t_c,
- _g_e_t_c_h_a_r, _p_u_t_c, _p_u_t_c_h_a_r, _f_e_r_r_o_r, _f_e_o_f, _c_l_e_a_r_e_r_r, and _f_i_l_e_n_o.
-
- Output streams, with the exception of the standard error stream _s_t_d_e_r_r,
- are by default buffered if the output refers to a file and line-buffered
- if the output refers to a terminal. The standard error output stream
- _s_t_d_e_r_r is by default unbuffered, but use of _f_r_e_o_p_e_n [see _f_o_p_e_n(3S)] will
- cause it to become buffered or line-buffered. When an output stream is
- unbuffered, information is queued for writing on the destination file or
- terminal as soon as written; when it is buffered, many characters are
- saved up and written as a block. When it is line-buffered, each line of
- output is queued for writing on the destination terminal as soon as the
- line is completed (that is, as soon as a new-line character is written or
- terminal input is requested). _s_e_t_b_u_f(3S) or _s_e_t_v_b_u_f(3S) in _s_e_t_b_u_f(3S)
- may be used to change the stream's buffering strategy.
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- open(2), close(2), lseek(2), pipe(2), read(2), write(2), ctermid(3S),
- cuserid(3S), fclose(3S), ferror(3S), fopen(3S), fread(3S), fseek(3S),
- getc(3S), gets(3S), popen(3S), printf(3S), putc(3S), puts(3S), scanf(3S),
- setbuf(3S), system(3S), tmpfile(3S), tmpnam(3S), ungetc(3S).
-
- DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
- Invalid _s_t_r_e_a_m pointers will usually cause grave disorder, possibly
- including program termination. Individual function descriptions describe
- the possible error conditions.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-